// 组件允许单个组件打包，因此默认引入公共基础样式

@import "../../base.less";

@import "./_var.less";

@import "./_mixin.less";

/* Alert */
.@{prefix}-alert {
  display: flex;
  padding: @alert-padding;
  opacity: 1;
  transition: opacity .2s;
  border-radius: @border-radius;

  &.@{prefix}-is-hidden { /* 隐藏 */
    display: none;
  }

  &--closing {
    opacity: 0;
  }

  &--info {
    background-color: @alert-info-bg-color;

    .@{prefix}-alert__icon {
      color: @alert-info-icon-color;
    }

    .@{prefix}-alert__swiper-trigger-wrap {
      color: @alert-info-trigger-color;
    }

    .@{prefix}-alert__swiper-trigger--active {
      color: @alert-info-trigger-active-color;
    }
  }

  &--success {
    background-color: @alert-success-bg-color;

    .@{prefix}-alert__icon {
      color: @alert-success-icon-color;
    }

    .@{prefix}-alert__swiper-trigger-wrap {
      color: @alert-success-trigger-color;
    }

    .@{prefix}-alert__swiper-trigger--active {
      color: @alert-success-trigger-active-color;
    }
  }

  &--warning {
    background-color: @alert-warning-bg-color;

    .@{prefix}-alert__icon {
      color: @alert-warning-icon-color;
    }

    .@{prefix}-alert__swiper-trigger-wrap {
      color: @alert-warning-trigger-color;
    }

    .@{prefix}-alert__swiper-trigger--active {
      color: @alert-warning-trigger-active-color;
    }
  }

  &--error {
    background-color: @alert-error-bg-color;

    .@{prefix}-alert__icon {
      color: @alert-error-icon-color;
    }

    .@{prefix}-alert__swiper-trigger-wrap {
      color: @alert-error-trigger-color;
    }

    .@{prefix}-alert__swiper-trigger--active {
      color: @alert-error-trigger-active-color;
    }
  }
}

.@{prefix}-alert__icon {
  font-size: @alert-icon-size;
  display: inherit;
}

.@{prefix}-alert__icon {
  > .@{prefix}-icon {
    font-size: @alert-icon-size;
  }
}

.@{prefix}-alert__icon,
.@{prefix}-alert__close {
  flex: 0 0 auto;
  line-height: @text-line-height-s;
}

.@{prefix}-alert__content {
  flex: 1 1 0;
  font-size: @font-size-base;
  line-height: @text-line-height-s;
  overflow: hidden;
}

.@{prefix}-alert__title,
.@{prefix}-alert__message {
  width: 100%;
  display: flex;
}

.@{prefix}-alert__title {
  color: @alert-title-color;
  font-weight: bold;

  + .@{prefix}-alert__message {
    margin-top: @spacer;
  }
}

.@{prefix}-alert__description {
  color: @alert-description-color;
  flex: 0 1 auto;
}

.@{prefix}-alert__operation {
  flex: 0 0 auto;
  padding: 0 @spacer;
  color: @brand-color;
  cursor: pointer;
  transition: color @anim-duration-base;

  &:hover {
    color: @brand-color-hover;
  }

  &:active {
    color: @brand-color-active;
  }
}

.@{prefix}-alert__icon + .@{prefix}-alert__content {
  margin-left: 10px;
}

.@{prefix}-alert__collapse {
  margin-top: 12px;
  color: @brand-color;
  cursor: pointer;
}

.@{prefix}-alert__close {
  font-size: @font-size-base;
  color: @alert-close-color;
  cursor: pointer;
}

/* Alert Swiper */
// can be removed when web-angular migrate swiper to a single component.
.@{prefix}-alert-swiper {
  display: flex;
  opacity: 1;
  transition: opacity .2s;

  &.@{prefix}-is-hidden { /* 隐藏 */
    display: none;
  }

  &--closing {
    opacity: 0;
  }

  &--info {
    background-color: @alert-info-bg-color;

    .@{prefix}-alert-swiper__trigger-wrap {
      color: @alert-info-trigger-color;
    }

    .@{prefix}-alert-swiper__trigger--active {
      color: @alert-info-trigger-active-color;
    }
  }

  &--success {
    background-color: @alert-success-bg-color;

    .@{prefix}-alert-swiper__trigger-wrap {
      color: @alert-success-trigger-color;
    }

    .@{prefix}-alert-swiper__trigger--active {
      color: @alert-success-trigger-active-color;
    }
  }

  &--warning {
    background-color: @alert-warning-bg-color;

    .@{prefix}-alert-swiper__trigger-wrap {
      color: @alert-warning-trigger-color;
    }

    .@{prefix}-alert-swiper__trigger--active {
      color: @alert-warning-trigger-active-color;
    }
  }

  &--error {
    background-color: @alert-error-bg-color;

    .@{prefix}-alert-swiper__trigger-wrap {
      color: @alert-error-trigger-color;
    }

    .@{prefix}-alert-swiper__trigger--active {
      color: @alert-error-trigger-active-color;
    }
  }
}

.@{prefix}-alert-swiper__content {
  flex: 1 1 auto;
  overflow: hidden;
}

.@{prefix}-alert-swiper__swiper-wrap {
  position: relative;
  display: flex;
  left: 0;
  transition: left 1s, transform 2s;

  > * {
    flex: 1;
  }
}

.@{prefix}-alert-swiper__trigger-wrap {
  padding: 14px 8px;
  flex: 0 0 auto;
  font-size: 20px;
  line-height: 20px;

  > li {
    display: inline-block;
    list-style-type: none;
    cursor: pointer;

    &::before {
      content: "\2022";
    }
  }
}

.@{prefix}-alert-swiper__close {
  padding: 14px 20px 14px 4px;
  flex: 0 0 auto;
  font-size: 14px;
  color: @text-color-placeholder;
  cursor: pointer;
  display: flex;
  align-items: center;
}
